#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
int NODE[N], LEFT[N], RIGHT[N];
int in = 1;
set<int> filter;
int newNode() {return in++;}
// 将 k 插入到 root 表示的排序二叉树当中
void insert(int root, int k)
{
    int pre = -1, cur = root;
    while(cur != 0)
    {
        pre = cur;
        if(k < NODE[cur]) cur = LEFT[cur];
        else cur = RIGHT[cur];
    }
    int node = newNode();
    NODE[node] = k;
    
    // 插入
    if(k < NODE[pre]) LEFT[pre] = node;
    else RIGHT[pre] = node;
}

void print(int root, int flag, string s)
{
    if(root)
    {
        filter.insert(flag);
        // 如果是叶子结点, 且不为根的情况
        if(LEFT[root] == 0 && RIGHT[root] == 0)
        {
            if(root != LEFT[1])
                cout << s << "|-" << NODE[root] << endl;
            else
                cout << s << NODE[root] << endl;
            return ;
        }
        int nflag;
        // 处理右孩子
        if(RIGHT[root])
        {
            string rs = s;
            int t = log10(NODE[root]) + 1;

            nflag = flag + 1;
            if(root == LEFT[1]) rs.append(t + 1, '.');
            else
            {
                if(filter.count(nflag) == 1)
                {
                    rs.append(1, '|');
                    rs.append(t + 2, '.');
                }
                else
                {
                    rs.append(t + 3, '.');
                }
            }
            print(RIGHT[root], nflag, rs);
        }

        // 处理当前结点, 如果是根节点不要 |-
        cout << s;
        if(root != LEFT[1]) cout << "|-";         
        cout << NODE[root] << "-|" << endl; 
        
        if(LEFT[root])
        {
            string ls = s;
            int t = log10(NODE[root]) + 1;

            nflag = flag - 1;
            if(root == LEFT[1]) ls.append(t + 1, '.');
            else
            {
                if(filter.count(nflag) == 1)
                {
                    ls.append(1, '|');
                    ls.append(t + 2, '.');
                }
                else
                {
                    ls.append(t + 3, '.');
                }
            }
            print(LEFT[root], nflag, ls);
        }
    }
}
int main()
{
#ifdef LOCAL
    freopen("PREV-11.in", "r", stdin);
#endif
    int root = newNode();
    NODE[root] = INT_MAX;
    int t;
    while(cin >> t)
    {
        insert(root, t);
    }
    print(LEFT[root], 0, "");
    return 0;
}